// Copyright (C) 2025, ZWSOFT Co., LTD.(Guangzhou)
// Licensed under the MIT License. See LICENSE in the project root for license information.

using Microsoft.Win32;

namespace TestClient.ViewModel.Util;
internal class DialogUtil
{
    public static string? ShowOpenFileDialog(string fileName, string defaultExt, string filter)
    {
        var dialog = new Microsoft.Win32.OpenFileDialog
        {
            FileName = fileName,
            DefaultExt = defaultExt,
            Filter = filter,
        };

        bool? result = dialog.ShowDialog();

        if (result == true)
        {
            return dialog.FileName;
        }

        return null;
    }
    public static string? ShowOpenDirectoryDialog(string defaultPath)
    {
        var dialog = new OpenFolderDialog
        {
            DefaultDirectory = defaultPath,
        };
        bool? result = dialog.ShowDialog();
        if (result == true)
        {
            return dialog.FolderName;
        }
        return null;
    }
}
